package com.kcht.np.common.config;

import com.baomidou.mybatisplus.extension.plugins.OptimisticLockerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
  * <p>
  * MybatisPlus配置
  * </p>
  *
  * @Package:        com.kcht.np.mp.common.config
  * @Description:    MybatisPlus配置
  * @Author:         liuqi
  * @CreateDate:     2020/3/31 10:47
 */
@Configuration
@MapperScan("com.kcht.*.mapper")
public class MybatisPlusConfig {

    /**
     * 1.分页插件
     * 2.多租户
     */
    @Bean
    public PaginationInterceptor paginationInterceptor() {
        return new PaginationInterceptor();
    }

    @Bean
    public OptimisticLockerInterceptor optimisticLockerInterceptor(){
        return new OptimisticLockerInterceptor();
    }

    /**
     * 自定义 SqlInjector
     * 里面包含自定义的全局方法
     */
//    @Bean
//    public MyLogicSqlInjector myLogicSqlInjector() {
//        return new MyLogicSqlInjector();
//    }
}
